<?php

namespace app\store\model;

use think\Model;
use think\model\concern\SoftDelete;

class SpikeGoods extends Model
{   
    use SoftDelete;

    protected $deleteTime = 'delete_time';

    protected $schema = [
        'id' => 'int',
        'store_id' => 'int',
        'goods_id' => 'int',
        'sort' => 'int',
        'sell_price' => 'float',
        'spike_price' => 'float',
        'spike_stock' => 'int',
        'total_sale' => 'int',
        'status' => 'int',
        'create_time' => 'timestamp',
        'update_time' => 'timestamp',
        'delete_time' => 'timestamp', 
    ];


    public function goods()
    {
        return $this->belongsTo(Goods::class);
    }

    public function goodsItems()
    {
        return $this->hasMany(GoodsItem::class,'id','goods_id');
    }


    public function items()
    {
        return $this->hasMany(SpikeGoodsItem::class);
    }

}